<template>
    <div class="main">
        {{title}}
        <img :src="$url+'/'+img" v-if="img" />
        <router-link to="/shop">返回</router-link>
    </div>
</template>

<script>
export default {
    data() {
        return {
            id:0,
            title:'',
            img:''
        }
    },
    async created () {
        this.id = this.$route.query.id
        
        var {data} = await this.$axios.get(this.$url+"/goods?id="+this.id);
        if( data.length === 0 ){
            this.$toast('没有找到数据')
        }else{
            this.title = data[0].title;
            this.img = data[0].img
        }
    }
}
</script>

<style>

</style>